﻿namespace ExamV5.PaperInfo
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class UserAddPaper : Page
    {
        protected Button butDefault;
        protected Button butShowRubricCount;
        protected CheckBox CBReadOtherUnit;
        protected DropDownList DDLCheckUser;
        protected DropDownList DDLDiffculty;
        protected DropDownList DDLEndH;
        protected DropDownList DDLEndM;
        protected DropDownList DDLPaperTemplet;
        protected DropDownList DDLStartH;
        protected DropDownList DDLStartM;
        protected DropDownList DDLStudy;
        protected HtmlForm Form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        protected int intID = 0;
        //protected Label labRubricAFenTip;
        //protected Label labRubricASumTip;
        //protected Label labRubricBFenTip;
        //protected Label labRubricBSumTip;
        //protected Label labRubricCFenTip;
        //protected Label labRubricCSumTip;
        //protected Label labRubricDFenTip;
        //protected Label labRubricDSumTip;
        //protected Label labRubricEFenTip;
        //protected Label labRubricESumTip;
        //protected Label labRubricFFenTip;
        //protected Label labRubricFSumTip;
        //protected Label labRubricGFenTip;
        //protected Label labRubricGSumTip;
        //protected Label labRubricHFenTip;
        //protected Label labRubricHSumTip;
        //protected Label labRubricIFenTip;
        //protected Label labRubricISumTip;
        //protected Label labRubricJFenTip;
        //protected Label labRubricJSumTip;
        protected Label labSumA;
        protected Label labSumB;
        protected Label labSumC;
        protected Label labSumD;
        protected Label labSumE;
        protected Label labSumF;
        protected Label labSumG;
        protected Label labSumH;
        protected Label labSumI;
        protected Label labSumJ;
        private PublicFun publicFun_0 = new PublicFun();
        protected RadioButtonList RBLEnterTime;
        protected RadioButtonList RBLExamShow;
        protected RadioButtonList RBLExamType;
        protected RadioButtonList RBLRubricShow;
        protected ScriptManager SM;
        protected string strSubjectID = "";
        protected string strSubjectName = "";
        protected TextBox txtAErrFen;
        protected TextBox txtANoWriteFen;
        protected TextBox txtBErrFen;
        protected TextBox txtBNoWriteFen;
        protected TextBox txtCErrFen;
        protected TextBox txtCNoWriteFen;
        protected TextBox txtEndDate;
        protected TextBox txtEndIP;
        protected TextBox txtExamName;
        protected TextBox txtExamTime;
        protected TextBox txtJoinExamNum;
        protected TextBox txtMemberFen;
        protected TextBox txtPaperSumFen;
        protected TextBox txtRubricAFen;
        protected TextBox txtRubricAMemo;
        protected TextBox txtRubricASum;
        protected TextBox txtRubricATip;
        protected TextBox txtRubricBFen;
        protected TextBox txtRubricBMemo;
        protected TextBox txtRubricBSum;
        protected TextBox txtRubricBTip;
        protected TextBox txtRubricCFen;
        protected TextBox txtRubricCMemo;
        protected TextBox txtRubricCSum;
        protected TextBox txtRubricCTip;
        protected TextBox txtRubricDFen;
        protected TextBox txtRubricDMemo;
        protected TextBox txtRubricDSum;
        protected TextBox txtRubricDTip;
        protected TextBox txtRubricEFen;
        protected TextBox txtRubricEMemo;
        protected TextBox txtRubricESum;
        protected TextBox txtRubricETip;
        protected TextBox txtRubricFFen;
        protected TextBox txtRubricFMemo;
        protected TextBox txtRubricFSum;
        protected TextBox txtRubricFTip;
        protected TextBox txtRubricGFen;
        protected TextBox txtRubricGMemo;
        protected TextBox txtRubricGSum;
        protected TextBox txtRubricGTip;
        protected TextBox txtRubricHFen;
        protected TextBox txtRubricHMemo;
        protected TextBox txtRubricHSum;
        protected TextBox txtRubricHTip;
        protected TextBox txtRubricIFen;
        protected TextBox txtRubricIMemo;
        protected TextBox txtRubricISum;
        protected TextBox txtRubricITip;
        protected TextBox txtRubricJFen;
        protected TextBox txtRubricJMemo;
        protected TextBox txtRubricJSum;
        protected TextBox txtRubricJTip;
        protected TextBox txtStartDate;
        protected TextBox txtStartIP;
        protected TextBox txtSumJRubricType;
        protected UpdatePanel UPPart;

        protected void butDefault_Click(object sender, EventArgs e)
        {
            string strSql = "";
            int num = 0;
            int num2 = 0;
            double num3 = 0.0;
            int num4 = 0;
            double num5 = 0.0;
            int num6 = 0;
            double num7 = 0.0;
            int num8 = 0;
            double num9 = 0.0;
            int num10 = 0;
            double num11 = 0.0;
            int num12 = 0;
            double num13 = 0.0;
            int num14 = 0;
            double num15 = 0.0;
            int num16 = 0;
            double num17 = 0.0;
            int num18 = 0;
            double num19 = 0.0;
            int num20 = 0;
            string str2 = "";
            string str3 = "A";
            string str4 = "N";
            double num21 = 0.0;
            double num22 = 0.0;
            double num23 = 0.0;
            double num24 = 0.0;
            double num25 = 0.0;
            double num26 = 0.0;
            try
            {
                num = Convert.ToInt32(this.txtPaperSumFen.Text.Trim());
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput1", "alert('试卷总分输入不合法！')", true);
                return;
            }
            if (num <= 0)
            {
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputA1", "alert('试卷总分输入不合法！')", true);
            }
            else if (this.txtRubricASum.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput2", "alert('请输入" + this.txtRubricATip.Text + "题数！')", true);
            }
            else
            {
                try
                {
                    num2 = Convert.ToInt32(this.txtRubricASum.Text.Trim());
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput3", "alert('" + this.txtRubricATip.Text + "题数输入不合法！')", true);
                    return;
                }
                if (this.txtRubricAFen.Text.Trim() == "")
                {
                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput4", "alert('请输入" + this.txtRubricATip.Text + "分值！')", true);
                }
                else
                {
                    try
                    {
                        num3 = Convert.ToDouble(this.txtRubricAFen.Text.Trim());
                    }
                    catch
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput5", "alert('" + this.txtRubricATip.Text + "分值不合法！')", true);
                        return;
                    }
                    try
                    {
                        num24 = Convert.ToDouble(this.txtANoWriteFen.Text.Trim());
                    }
                    catch
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputNoWriteA", "alert('" + this.txtRubricATip.Text + "未答倒扣分值不合法！')", true);
                        return;
                    }
                    try
                    {
                        num21 = Convert.ToDouble(this.txtAErrFen.Text.Trim());
                    }
                    catch
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputErrFenA", "alert('" + this.txtRubricATip.Text + "答错倒扣分值不合法！')", true);
                        return;
                    }
                    if (this.txtRubricBSum.Text.Trim() == "")
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput6", "alert('请输入" + this.txtRubricBTip.Text + "题数！')", true);
                    }
                    else
                    {
                        try
                        {
                            num4 = Convert.ToInt32(this.txtRubricBSum.Text.Trim());
                        }
                        catch
                        {
                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput7", "alert('" + this.txtRubricBTip.Text + "题数输入不合法！')", true);
                            return;
                        }
                        if (this.txtRubricBFen.Text.Trim() == "")
                        {
                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput8", "alert('请输入" + this.txtRubricBTip.Text + "分值！')", true);
                        }
                        else
                        {
                            try
                            {
                                num5 = Convert.ToDouble(this.txtRubricBFen.Text.Trim());
                            }
                            catch
                            {
                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput9", "alert('" + this.txtRubricBTip.Text + "分值不合法！')", true);
                                return;
                            }
                            try
                            {
                                num25 = Convert.ToDouble(this.txtBNoWriteFen.Text.Trim());
                            }
                            catch
                            {
                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BNoWriteB", "alert('" + this.txtRubricBTip.Text + "未答倒扣分值不合法！')", true);
                                return;
                            }
                            try
                            {
                                num22 = Convert.ToDouble(this.txtBErrFen.Text.Trim());
                            }
                            catch
                            {
                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BErrFenB", "alert('" + this.txtRubricBTip.Text + "答错倒扣分值不合法！')", true);
                                return;
                            }
                            if (this.txtRubricCSum.Text.Trim() == "")
                            {
                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput10", "alert('请输入" + this.txtRubricCTip.Text + "题数！')", true);
                            }
                            else
                            {
                                try
                                {
                                    num6 = Convert.ToInt32(this.txtRubricCSum.Text.Trim());
                                }
                                catch
                                {
                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput11", "alert('" + this.txtRubricCTip.Text + "题数输入不合法！')", true);
                                    return;
                                }
                                if (this.txtRubricCFen.Text.Trim() == "")
                                {
                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput12", "alert('请输入" + this.txtRubricCTip.Text + "分值！')", true);
                                }
                                else
                                {
                                    try
                                    {
                                        num7 = Convert.ToDouble(this.txtRubricCFen.Text.Trim());
                                    }
                                    catch
                                    {
                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput13", "alert('" + this.txtRubricCTip.Text + "分值不合法！')", true);
                                        return;
                                    }
                                    try
                                    {
                                        num26 = Convert.ToDouble(this.txtCNoWriteFen.Text.Trim());
                                    }
                                    catch
                                    {
                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BNoWriteC", "alert('" + this.txtRubricCTip.Text + "未答倒扣分值不合法！')", true);
                                        return;
                                    }
                                    try
                                    {
                                        num23 = Convert.ToDouble(this.txtCErrFen.Text.Trim());
                                    }
                                    catch
                                    {
                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BErrFenC", "alert('" + this.txtRubricCTip.Text + "答错倒扣分值不合法！')", true);
                                        return;
                                    }
                                    if (this.txtRubricDSum.Text.Trim() == "")
                                    {
                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput14", "alert('请输入" + this.txtRubricDTip.Text + "题数！')", true);
                                    }
                                    else
                                    {
                                        try
                                        {
                                            num8 = Convert.ToInt32(this.txtRubricDSum.Text.Trim());
                                        }
                                        catch
                                        {
                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput15", "alert('" + this.txtRubricDTip.Text + "题数输入不合法！')", true);
                                            return;
                                        }
                                        if (this.txtRubricDFen.Text.Trim() == "")
                                        {
                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput16", "alert('请输入" + this.txtRubricDTip.Text + "分值！')", true);
                                        }
                                        else
                                        {
                                            try
                                            {
                                                num9 = Convert.ToDouble(this.txtRubricDFen.Text.Trim());
                                            }
                                            catch
                                            {
                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput17", "alert('" + this.txtRubricDTip.Text + "分值不合法！')", true);
                                                return;
                                            }
                                            if (this.txtRubricESum.Text.Trim() == "")
                                            {
                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput18", "alert('请输入" + this.txtRubricETip.Text + "题数！')", true);
                                            }
                                            else
                                            {
                                                try
                                                {
                                                    num10 = Convert.ToInt32(this.txtRubricESum.Text.Trim());
                                                }
                                                catch
                                                {
                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput19", "alert('" + this.txtRubricETip.Text + "题数输入不合法！')", true);
                                                    return;
                                                }
                                                if (this.txtRubricEFen.Text.Trim() == "")
                                                {
                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput20", "alert('请输入" + this.txtRubricETip.Text + "分值！')", true);
                                                }
                                                else
                                                {
                                                    try
                                                    {
                                                        num11 = Convert.ToDouble(this.txtRubricEFen.Text.Trim());
                                                    }
                                                    catch
                                                    {
                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput21", "alert('" + this.txtRubricETip.Text + "分值不合法！')", true);
                                                        return;
                                                    }
                                                    if (this.txtRubricFSum.Text.Trim() == "")
                                                    {
                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput22", "alert('请输入" + this.txtRubricFTip.Text + "题数！')", true);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            num12 = Convert.ToInt32(this.txtRubricFSum.Text.Trim());
                                                        }
                                                        catch
                                                        {
                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput23", "alert('" + this.txtRubricFTip.Text + "题数输入不合法！')", true);
                                                            return;
                                                        }
                                                        if (this.txtRubricFFen.Text.Trim() == "")
                                                        {
                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput24", "alert('请输入" + this.txtRubricFTip.Text + "分值！')", true);
                                                        }
                                                        else
                                                        {
                                                            try
                                                            {
                                                                num13 = Convert.ToDouble(this.txtRubricFFen.Text.Trim());
                                                            }
                                                            catch
                                                            {
                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput25", "alert('" + this.txtRubricFTip.Text + "分值不合法！')", true);
                                                                return;
                                                            }
                                                            if (this.txtRubricGSum.Text.Trim() == "")
                                                            {
                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput26", "alert('请输入" + this.txtRubricGTip.Text + "题数！')", true);
                                                            }
                                                            else
                                                            {
                                                                try
                                                                {
                                                                    num14 = Convert.ToInt32(this.txtRubricGSum.Text.Trim());
                                                                }
                                                                catch
                                                                {
                                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput27", "alert('" + this.txtRubricGTip.Text + "题数输入不合法！')", true);
                                                                    return;
                                                                }
                                                                if (this.txtRubricGFen.Text.Trim() == "")
                                                                {
                                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput28", "alert('请输入" + this.txtRubricGTip.Text + "分值！')", true);
                                                                }
                                                                else
                                                                {
                                                                    try
                                                                    {
                                                                        num15 = Convert.ToDouble(this.txtRubricGFen.Text.Trim());
                                                                    }
                                                                    catch
                                                                    {
                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput29", "alert('" + this.txtRubricGTip.Text + "分值不合法！')", true);
                                                                        return;
                                                                    }
                                                                    if (this.txtRubricHSum.Text.Trim() == "")
                                                                    {
                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput30", "alert('请输入" + this.txtRubricHTip.Text + "题数！')", true);
                                                                    }
                                                                    else
                                                                    {
                                                                        try
                                                                        {
                                                                            num16 = Convert.ToInt32(this.txtRubricHSum.Text.Trim());
                                                                        }
                                                                        catch
                                                                        {
                                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput31", "alert('" + this.txtRubricHTip.Text + "题数输入不合法！')", true);
                                                                            return;
                                                                        }
                                                                        if (this.txtRubricHFen.Text.Trim() == "")
                                                                        {
                                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput32", "alert('请输入" + this.txtRubricHTip.Text + "分值！')", true);
                                                                        }
                                                                        else
                                                                        {
                                                                            try
                                                                            {
                                                                                num17 = Convert.ToDouble(this.txtRubricHFen.Text.Trim());
                                                                            }
                                                                            catch
                                                                            {
                                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput33", "alert('" + this.txtRubricHTip.Text + "分值不合法！')", true);
                                                                                return;
                                                                            }
                                                                            if (this.txtRubricISum.Text.Trim() == "")
                                                                            {
                                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput34", "alert('请输入" + this.txtRubricITip.Text + "题数！')", true);
                                                                            }
                                                                            else
                                                                            {
                                                                                try
                                                                                {
                                                                                    num18 = Convert.ToInt32(this.txtRubricISum.Text.Trim());
                                                                                }
                                                                                catch
                                                                                {
                                                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput35", "alert('" + this.txtRubricITip.Text + "题数输入不合法！')", true);
                                                                                    return;
                                                                                }
                                                                                if (this.txtRubricIFen.Text.Trim() == "")
                                                                                {
                                                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput36", "alert('请输入" + this.txtRubricITip.Text + "分值！')", true);
                                                                                }
                                                                                else
                                                                                {
                                                                                    try
                                                                                    {
                                                                                        num19 = Convert.ToDouble(this.txtRubricIFen.Text.Trim());
                                                                                    }
                                                                                    catch
                                                                                    {
                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput37", "alert('" + this.txtRubricITip.Text + "分值不合法！')", true);
                                                                                        return;
                                                                                    }
                                                                                    try
                                                                                    {
                                                                                        num20 = Convert.ToInt32(this.txtExamTime.Text.Trim());
                                                                                    }
                                                                                    catch
                                                                                    {
                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput38", "alert('考试时间输入不合法！')", true);
                                                                                        return;
                                                                                    }
                                                                                    if (Convert.ToDateTime(this.txtStartDate.Text) > Convert.ToDateTime(this.txtEndDate.Text))
                                                                                    {
                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput39", "alert('考试有效期限不合法！')", true);
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        double num31 = 0.0;
                                                                                        string str16 = "正规试题";
                                                                                        num31 = ((((((((num2 * num3) + (num4 * num5)) + (num6 * num7)) + (num8 * num9)) + (num10 * num11)) + (num12 * num13)) + (num14 * num15)) + (num16 * num17)) + (num18 * num19);
                                                                                        num31 += Convert.ToDouble(this.txtSumJRubricType.Text.Trim());
                                                                                        if (num != Convert.ToInt16(num31))
                                                                                        {
                                                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput40", "alert('试卷总分与题型分值总和不一致！')", true);
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            if (this.DDLCheckUser.SelectedItem.Value != "0")
                                                                                            {
                                                                                                str2 = this.DDLCheckUser.SelectedItem.Value;
                                                                                                str4 = "Y";
                                                                                            }
                                                                                            if (this.RBLExamType.SelectedItem.Value == "B")
                                                                                            {
                                                                                                str3 = "B";
                                                                                                str16 = "练习试题";
                                                                                            }
                                                                                            if (this.RBLExamType.SelectedItem.Value == "A")
                                                                                            {
                                                                                                str3 = "A";
                                                                                                str16 = "正规试题";
                                                                                            }
                                                                                            if (this.RBLExamType.SelectedItem.Value == "C")
                                                                                            {
                                                                                                str3 = "C";
                                                                                                str16 = "模拟试题";
                                                                                            }
                                                                                            string[] strArray3 = this.txtStartIP.Text.Trim().Split(new char[] { '.' });
                                                                                            string[] strArray4 = this.txtEndIP.Text.Trim().Split(new char[] { '.' });
                                                                                            if (strArray3.Length != 4)
                                                                                            {
                                                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput25", "alert('IP地址不合法！')", true);
                                                                                            }
                                                                                            else if (strArray4.Length != 4)
                                                                                            {
                                                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput25", "alert('IP地址不合法！')", true);
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                int num30;
                                                                                                for (num30 = 0; num30 < strArray3.Length; num30++)
                                                                                                {
                                                                                                    if ((((int.Parse(strArray3[num30]) < 0) || (int.Parse(strArray3[num30]) > 0xff)) || (int.Parse(strArray4[num30]) < 0)) || (int.Parse(strArray4[num30]) > 0xff))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput25", "alert('IP地址不合法！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                this.strSubjectName = base.Request.Form["txtSubjectName"].ToString().Trim().Replace("│", "").Replace("├", "");
                                                                                                this.strSubjectID = base.Request.Form["txtSubjectID"].ToString().Trim();
                                                                                                string[] strArray2 = this.strSubjectID.Split(new char[] { ',' });
                                                                                                string str25 = "";
                                                                                                for (num30 = 0; num30 < strArray2.Length; num30++)
                                                                                                {
                                                                                                    if (strArray2[num30].Trim() != "")
                                                                                                    {
                                                                                                        if (str25.Trim().Length == 0)
                                                                                                        {
                                                                                                            str25 = " (SubjectID='" + strArray2[num30].Trim() + "' ";
                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            str25 = str25 + " or SubjectID='" + strArray2[num30].Trim() + "' ";
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                if (!(str25.Trim() != ""))
                                                                                                {
                                                                                                    str25 = " ID<>0 ";
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    str25 = str25 + ")";
                                                                                                }
                                                                                                if (this.CBReadOtherUnit.Checked)
                                                                                                {
                                                                                                    strSql = "select count(*) as RubricCount from RubricInfo where IsDel='N' and Flag='" + str3 + "' and ISCheck='N' and " + str25 + "  and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))";
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    strSql = "select count(*) as RubricCount from RubricInfo where IsDel='N' and Flag='" + str3 + "' and ISCheck='N' and " + str25 + "  and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')";
                                                                                                }
                                                                                                if (num2 > 0)
                                                                                                {
                                                                                                    string str24 = strSql + " and RubricType='A'";
                                                                                                    if (num2 > Convert.ToInt32(this.publicFun_0.GetValues(str24, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR1", "alert('" + str16 + "题库中的" + this.txtRubricATip.Text + "总数为:" + num2.ToString() + "道,请勿超出！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num4 > 0)
                                                                                                {
                                                                                                    string str23 = strSql + " and RubricType='B'";
                                                                                                    if (num4 > Convert.ToInt32(this.publicFun_0.GetValues(str23, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR2", "alert('" + str16 + "题库中的" + this.txtRubricBTip.Text + "总数为:" + num4.ToString() + "道,请勿超出！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num6 > 0)
                                                                                                {
                                                                                                    string str22 = strSql + " and RubricType='C'";
                                                                                                    if (num6 > Convert.ToInt32(this.publicFun_0.GetValues(str22, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR3", "alert('" + str16 + "题库中的" + this.txtRubricCTip.Text + "总数为:" + num6.ToString() + "道,请勿超出！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num8 > 0)
                                                                                                {
                                                                                                    string str21 = strSql + " and RubricType='D'";
                                                                                                    if (num8 > Convert.ToInt32(this.publicFun_0.GetValues(str21, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR4", "alert('" + str16 + "题库中的" + this.txtRubricDTip.Text + "总数为:" + num8.ToString() + "道,请勿超出！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num10 > 0)
                                                                                                {
                                                                                                    string str20 = strSql + " and RubricType='E'";
                                                                                                    if (num10 > Convert.ToInt32(this.publicFun_0.GetValues(str20, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR5", "alert('" + str16 + "题库中的" + this.txtRubricETip.Text + "总数为:" + num10.ToString() + "道,请勿超出！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num12 > 0)
                                                                                                {
                                                                                                    string str19 = strSql + " and RubricType='F'";
                                                                                                    if (num12 > Convert.ToInt32(this.publicFun_0.GetValues(str19, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR6", "alert('" + str16 + "题库中的" + this.txtRubricFTip.Text + "总数为:" + num12.ToString() + "道,请勿超出！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num14 > 0)
                                                                                                {
                                                                                                    string str18 = strSql + " and RubricType='G'";
                                                                                                    if (num14 > Convert.ToInt32(this.publicFun_0.GetValues(str18, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR7", "alert('" + str16 + "题库中的" + this.txtRubricGTip.Text + "总数为:" + num14.ToString() + "道,请勿超出！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num16 > 0)
                                                                                                {
                                                                                                    string str17 = strSql + " and RubricType='H'";
                                                                                                    if (num16 > Convert.ToInt32(this.publicFun_0.GetValues(str17, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR8", "alert('" + str16 + "题库中的" + this.txtRubricHTip.Text + "总数为:" + num16.ToString() + "道,请勿超出！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num18 > 0)
                                                                                                {
                                                                                                    string str15 = strSql + " and RubricType='I'";
                                                                                                    if (num18 > Convert.ToInt32(this.publicFun_0.GetValues(str15, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR9", "alert('" + str16 + "题库中的" + this.txtRubricITip.Text + "总数为:" + num18.ToString() + "道,请勿超出！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                string str9 = this.txtRubricATip.Text.Trim() + "#" + this.txtRubricBTip.Text.Trim() + "#" + this.txtRubricCTip.Text.Trim() + "#" + this.txtRubricDTip.Text.Trim() + "#" + this.txtRubricETip.Text.Trim() + "#" + this.txtRubricFTip.Text.Trim() + "#" + this.txtRubricGTip.Text.Trim() + "#" + this.txtRubricHTip.Text.Trim() + "#" + this.txtRubricITip.Text.Trim() + "#" + this.txtRubricJTip.Text.Trim();
                                                                                                string str10 = num2.ToString() + "#" + num4.ToString() + "#" + num6.ToString() + "#" + num8.ToString() + "#" + num10.ToString() + "#" + num12.ToString() + "#" + num14.ToString() + "#" + num16.ToString() + "#" + num18.ToString();
                                                                                                string str11 = num3.ToString() + "#" + num5.ToString() + "#" + num7.ToString() + "#" + num9.ToString() + "#" + num11.ToString() + "#" + num13.ToString() + "#" + num15.ToString() + "#" + num17.ToString() + "#" + num19.ToString();
                                                                                                string str12 = this.txtRubricAMemo.Text.Trim() + "#" + this.txtRubricBMemo.Text.Trim() + "#" + this.txtRubricCMemo.Text.Trim() + "#" + this.txtRubricDMemo.Text.Trim() + "#" + this.txtRubricEMemo.Text.Trim() + "#" + this.txtRubricFMemo.Text.Trim() + "#" + this.txtRubricGMemo.Text.Trim() + "#" + this.txtRubricHMemo.Text.Trim() + "#" + this.txtRubricIMemo.Text.Trim().Replace("#", "＃");
                                                                                                string str13 = this.txtStartDate.Text.Trim() + " " + this.DDLStartH.SelectedItem.Value + ":" + this.DDLStartM.SelectedItem.Value + ":00";
                                                                                                string str14 = this.txtEndDate.Text.Trim() + " " + this.DDLEndH.SelectedItem.Value + ":" + this.DDLEndM.SelectedItem.Value + ":00";
                                                                                                string str8 = num21.ToString() + "#" + num22.ToString() + "#" + num23.ToString() + "#######";
                                                                                                string str7 = num24.ToString() + "#" + num25.ToString() + "#" + num26.ToString() + "#######";
                                                                                                int sqlID = 0;
                                                                                                if (this.txtMemberFen.Text.Trim() == "")
                                                                                                {
                                                                                                    this.txtMemberFen.Text = "0";
                                                                                                }
                                                                                                string str6 = "1";
                                                                                                if (!this.CBReadOtherUnit.Checked)
                                                                                                {
                                                                                                    str6 = "0";
                                                                                                }
                                                                                                int num29 = 0;
                                                                                                if (!(this.txtJoinExamNum.Text.Trim() == ""))
                                                                                                {
                                                                                                    num29 = Convert.ToInt16(this.txtJoinExamNum.Text.Trim());
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    num29 = 0;
                                                                                                }
                                                                                                strSql = "insert into PaperInfo(EnterTime,NoWriteFen,ErrorFen,SubjectID,InputUserCode,StartIP,EndIP,IsShow,RubricTypeName,JoinExamNum,StudyPlanID,OutPutType,MemberFen,ExamName,SubjectName,PaperFen,PaperDiff,RubricDist,FenDist,MemoDist,ExamTime,PaperStartTime,PaperEndTime,IsCheck,CheckMan,Flag,PaperStatus,InputMan)";
                                                                                                strSql = string.Concat(new object[] { 
                                                                                                    strSql, " values('", this.RBLEnterTime.SelectedItem.Value, "','", str7, "','", str8, "','", this.strSubjectID, "','", this.httpCookie_0.Value, "','", this.txtStartIP.Text.Trim(), "','", this.txtEndIP.Text.Trim(), "','", 
                                                                                                    this.RBLExamShow.SelectedItem.Value, "','", str9, "',", num29, ",", this.DDLStudy.SelectedItem.Value, ",'", this.RBLRubricShow.SelectedItem.Value, "',", this.txtMemberFen.Text.Trim(), ",'", this.publicFun_0.CheckString(this.txtExamName.Text), "','", this.strSubjectName.Trim().Replace(",", "、"), "',", 
                                                                                                    num, ",'", this.DDLDiffculty.SelectedItem.Value, "','", str10.Trim(), "#", this.txtRubricJSum.Text.Trim(), "','", str11.Trim(), "#", this.txtRubricJFen.Text.Trim(), "',"
                                                                                                 });
                                                                                                strSql = string.Concat(new object[] { 
                                                                                                    strSql, "'", str12.Trim(), "#", this.txtRubricJMemo.Text.Trim().Replace("#", "＃"), "',", num20, ",'", str13.Trim(), "','", str14.Trim(), "','", str4, "','", str2, "','A','", 
                                                                                                    this.RBLExamType.SelectedItem.Value, "','", this.httpCookie_1.Value, "')"
                                                                                                 });
                                                                                                sqlID = this.publicFun_0.GetSqlID(strSql);
                                                                                                if (sqlID != 0)
                                                                                                {
                                                                                                    if (this.method_6(sqlID) == 0)
                                                                                                    {
                                                                                                        if (str2.Trim() != "")
                                                                                                        {
                                                                                                            strSql = "Insert into SysTip(InfoTitle,InfoContent,InfoURL,FormType,Flag,GetNumber,SendNumber,Formtable,FormID) values(";
                                                                                                            strSql = string.Concat(new object[] { strSql, "'试卷信息等待您的审核处理！','','PaperInfo/FrmManagPaperList.aspx','B','A','", str2.Trim(), "','", this.httpCookie_0.Value, "','PaperInfo',", sqlID, ")" });
                                                                                                            this.publicFun_0.GetSqlID(strSql);
                                                                                                        }
                                                                                                        int num28 = 0;
                                                                                                        if (base.Request["ID"] != null)
                                                                                                        {
                                                                                                            num28 = Convert.ToInt32(base.Request["ID"]);
                                                                                                        }
                                                                                                        string str5 = base.Request.Url.ToString();
                                                                                                        str5 = str5.Substring(0, str5.LastIndexOf('/') + 1);
                                                                                                        base.Response.Redirect(string.Concat(new object[] { str5, "FrmPaperChooseRubric.aspx?IsRead=", str6, "&UPID=", num28, "&ID=", sqlID, "&ExamType=", this.RBLExamType.SelectedItem.Value }));
                                                                                                    }
                                                                                                    else
                                                                                                    {
                                                                                                        strSql = string.Concat(new object[] { "delete from GradeReule where PaperID=", sqlID, ";Delete from PaperInfo where ID=", sqlID, ";delete from SysTip where  Formtable='PaperInfo' and FormID=", sqlID });
                                                                                                        sqlID = this.publicFun_0.ExecuteSql(strSql);
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR9", "alert('新建随机组卷信息失败！')", true);
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        protected void butShowRubricCount_Click(object sender, EventArgs e)
        {
            this.method_5();
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
        }

        protected void DDLPaperTemplet_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.DDLPaperTemplet.SelectedItem.Value != "0")
            {
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
                SqlCommand command = new SqlCommand("select * from TemplatePaper where ID=" + this.DDLPaperTemplet.SelectedItem.Value, connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                if (reader.Read())
                {
                    this.RBLExamShow.SelectedIndex = -1;
                    this.txtStartIP.Text = reader["StartIP"].ToString();
                    this.txtEndIP.Text = reader["EndIP"].ToString();
                    this.RBLExamShow.Items.FindByValue(reader["IsShow"].ToString()).Selected = true;
                    this.RBLRubricShow.SelectedIndex = -1;
                    this.RBLRubricShow.Items.FindByValue(reader["OutPutType"].ToString()).Selected = true;
                    this.RBLExamType.SelectedIndex = -1;
                    this.RBLExamType.Items.FindByValue(reader["PaperStatus"].ToString()).Selected = true;
                    this.DDLDiffculty.SelectedIndex = -1;
                    this.DDLDiffculty.Items.FindByValue(reader["Difficult"].ToString()).Selected = true;
                    this.txtPaperSumFen.Text = reader["PaperSumFen"].ToString();
                    this.txtExamTime.Text = reader["ExamTime"].ToString();
                    string[] strArray = reader["RubricDist"].ToString().Split(new char[] { '#' });
                    string[] strArray2 = reader["FenDist"].ToString().Split(new char[] { '#' });
                    string[] strArray3 = reader["MemoDist"].ToString().Split(new char[] { '#' });
                    this.txtRubricASum.Text = strArray[0];
                    this.txtRubricBSum.Text = strArray[1];
                    this.txtRubricCSum.Text = strArray[2];
                    this.txtRubricDSum.Text = strArray[3];
                    this.txtRubricESum.Text = strArray[4];
                    this.txtRubricFSum.Text = strArray[5];
                    this.txtRubricGSum.Text = strArray[6];
                    this.txtRubricHSum.Text = strArray[7];
                    this.txtRubricISum.Text = strArray[8];
                    this.txtRubricAFen.Text = strArray2[0];
                    this.txtRubricBFen.Text = strArray2[1];
                    this.txtRubricCFen.Text = strArray2[2];
                    this.txtRubricDFen.Text = strArray2[3];
                    this.txtRubricEFen.Text = strArray2[4];
                    this.txtRubricFFen.Text = strArray2[5];
                    this.txtRubricGFen.Text = strArray2[6];
                    this.txtRubricHFen.Text = strArray2[7];
                    this.txtRubricIFen.Text = strArray2[8];
                    this.txtRubricAMemo.Text = strArray3[0];
                    this.txtRubricBMemo.Text = strArray3[1];
                    this.txtRubricCMemo.Text = strArray3[2];
                    this.txtRubricDMemo.Text = strArray3[3];
                    this.txtRubricEMemo.Text = strArray3[4];
                    this.txtRubricFMemo.Text = strArray3[5];
                    this.txtRubricGMemo.Text = strArray3[6];
                    this.txtRubricHMemo.Text = strArray3[7];
                    this.txtRubricIMemo.Text = strArray3[8];
                    string[] strArray4 = reader["RubricTypeName"].ToString().Split(new char[] { '#' });
                    this.txtRubricATip.Text = strArray4[0].Trim();
                    this.txtRubricBTip.Text = strArray4[1].Trim();
                    this.txtRubricCTip.Text = strArray4[2].Trim();
                    this.txtRubricDTip.Text = strArray4[3].Trim();
                    this.txtRubricETip.Text = strArray4[4].Trim();
                    this.txtRubricFTip.Text = strArray4[5].Trim();
                    this.txtRubricGTip.Text = strArray4[6].Trim();
                    this.txtRubricHTip.Text = strArray4[7].Trim();
                    this.txtRubricITip.Text = strArray4[8].Trim();
                    string[] strArray5 = reader["NoWriteFen"].ToString().Split(new char[] { '#' });
                    string[] strArray6 = reader["ErrorFen"].ToString().Split(new char[] { '#' });
                    this.txtAErrFen.Text = strArray6[0].ToString();
                    this.txtBErrFen.Text = strArray6[1].ToString();
                    this.txtCErrFen.Text = strArray6[2].ToString();
                    this.txtANoWriteFen.Text = strArray5[0].ToString();
                    this.txtBNoWriteFen.Text = strArray5[1].ToString();
                    this.txtCNoWriteFen.Text = strArray5[2].ToString();
                }
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
        }

        private void method_0()
        {
            this.DDLStudy.DataTextField = "PlanName";
            this.DDLStudy.DataValueField = "ID";
            string strSql = "select ID,PlanName from StudyPlanInfo where Convert(dateTime,PlanEndTime)>=getdate()";
            string values = this.publicFun_0.GetValues("select ManagStudyPlan from UserPower where UserCode='" + this.httpCookie_0.Value + "'", "ManagStudyPlan");
            if (!((this.publicFun_0.GetValues("select AddStudyPlan from UserPower where UserCode='" + this.httpCookie_0.Value + "'", "AddStudyPlan") == "Y") ? !(values == "N") : true))
            {
                strSql = strSql + " and InputMan='" + this.httpCookie_0.Value + "'";
            }
            strSql = strSql + "  order by ID desc";
            this.DDLStudy.DataSource = this.publicFun_0.RetrunDataView(strSql);
            this.DDLStudy.DataBind();
            ListItem item = new ListItem("不关联任何学习任务", "0");
            this.DDLStudy.Items.Insert(0, item);
        }

        private void method_1()
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("select * from PaperInfo where ID=" + Convert.ToInt32(base.Request["ID"].ToString()), connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                this.RBLExamShow.SelectedIndex = -1;
                this.txtStartIP.Text = reader["StartIP"].ToString();
                this.txtEndIP.Text = reader["EndIP"].ToString();
                this.RBLExamShow.Items.FindByValue(reader["IsShow"].ToString()).Selected = true;
                this.txtMemberFen.Text = reader["MemberFen"].ToString();
                this.txtExamName.Text = reader["ExamName"].ToString();
                this.RBLRubricShow.SelectedIndex = -1;
                this.RBLRubricShow.Items.FindByValue(reader["OutPutType"].ToString()).Selected = true;
                this.txtJoinExamNum.Text = reader["JoinExamNum"].ToString();
                this.strSubjectName = reader["SubjectName"].ToString().Replace("、", ",");
                this.strSubjectID = reader["SubjectID"].ToString();
                this.DDLPaperTemplet.SelectedIndex = -1;
                this.DDLDiffculty.SelectedIndex = -1;
                this.DDLDiffculty.Items.FindByValue(reader["PaperDiff"].ToString()).Selected = true;
                this.RBLExamType.SelectedIndex = -1;
                this.RBLExamType.Items.FindByValue(reader["PaperStatus"].ToString()).Selected = true;
                this.txtPaperSumFen.Text = reader["PaperFen"].ToString();
                string[] strArray4 = reader["RubricDist"].ToString().Split(new char[] { '#' });
                string[] strArray5 = reader["FenDist"].ToString().Split(new char[] { '#' });
                string[] strArray6 = reader["MemoDist"].ToString().Split(new char[] { '#' });
                this.txtRubricASum.Text = strArray4[0].ToString();
                this.txtRubricAFen.Text = strArray5[0].ToString();
                this.txtRubricAMemo.Text = strArray6[0].ToString();
                this.txtRubricBSum.Text = strArray4[1].ToString();
                this.txtRubricBFen.Text = strArray5[1].ToString();
                this.txtRubricBMemo.Text = strArray6[1].ToString();
                this.txtRubricCSum.Text = strArray4[2].ToString();
                this.txtRubricCFen.Text = strArray5[2].ToString();
                this.txtRubricCMemo.Text = strArray6[2].ToString();
                this.txtRubricDSum.Text = strArray4[3].ToString();
                this.txtRubricDFen.Text = strArray5[3].ToString();
                this.txtRubricDMemo.Text = strArray6[3].ToString();
                this.txtRubricESum.Text = strArray4[4].ToString();
                this.txtRubricEFen.Text = strArray5[4].ToString();
                this.txtRubricEMemo.Text = strArray6[4].ToString();
                this.txtRubricFSum.Text = strArray4[5].ToString();
                this.txtRubricFFen.Text = strArray5[5].ToString();
                this.txtRubricFMemo.Text = strArray6[5].ToString();
                this.txtRubricGSum.Text = strArray4[6].ToString();
                this.txtRubricGFen.Text = strArray5[6].ToString();
                this.txtRubricGMemo.Text = strArray6[6].ToString();
                this.txtRubricHSum.Text = strArray4[7].ToString();
                this.txtRubricHFen.Text = strArray5[7].ToString();
                this.txtRubricHMemo.Text = strArray6[7].ToString();
                this.txtRubricISum.Text = strArray4[8].ToString();
                this.txtRubricIFen.Text = strArray5[8].ToString();
                this.txtRubricIMemo.Text = strArray6[8].ToString();
                this.txtRubricJSum.Text = strArray4[9].ToString();
                this.txtRubricJFen.Text = strArray5[9].ToString();
                this.txtRubricJMemo.Text = strArray6[9].ToString();
                this.txtExamTime.Text = reader["ExamTime"].ToString();
                try
                {
                    this.DDLStudy.Items.FindByValue(reader["StudyPlanID"].ToString()).Selected = true;
                }
                catch
                {
                }
                double num = Convert.ToDouble(this.txtRubricASum.Text) * Convert.ToDouble(this.txtRubricAFen.Text);
                num += Convert.ToDouble(this.txtRubricBSum.Text) * Convert.ToDouble(this.txtRubricBFen.Text);
                num += Convert.ToDouble(this.txtRubricCSum.Text) * Convert.ToDouble(this.txtRubricCFen.Text);
                num += Convert.ToDouble(this.txtRubricDSum.Text) * Convert.ToDouble(this.txtRubricDFen.Text);
                num += Convert.ToDouble(this.txtRubricESum.Text) * Convert.ToDouble(this.txtRubricEFen.Text);
                num += Convert.ToDouble(this.txtRubricFSum.Text) * Convert.ToDouble(this.txtRubricFFen.Text);
                num += Convert.ToDouble(this.txtRubricGSum.Text) * Convert.ToDouble(this.txtRubricGFen.Text);
                num += Convert.ToDouble(this.txtRubricHSum.Text) * Convert.ToDouble(this.txtRubricHFen.Text);
                num += Convert.ToDouble(this.txtRubricISum.Text) * Convert.ToDouble(this.txtRubricIFen.Text);
                this.txtSumJRubricType.Text = (Convert.ToDouble(reader["PaperFen"]) - num).ToString("0.00");
                string[] strArray = reader["RubricTypeName"].ToString().Split(new char[] { '#' });
                this.txtRubricATip.Text = strArray[0].Trim();
                this.txtRubricBTip.Text = strArray[1].Trim();
                this.txtRubricCTip.Text = strArray[2].Trim();
                this.txtRubricDTip.Text = strArray[3].Trim();
                this.txtRubricETip.Text = strArray[4].Trim();
                this.txtRubricFTip.Text = strArray[5].Trim();
                this.txtRubricGTip.Text = strArray[6].Trim();
                this.txtRubricHTip.Text = strArray[7].Trim();
                this.txtRubricITip.Text = strArray[8].Trim();
                this.txtRubricJTip.Text = strArray[9].Trim();
                string[] strArray2 = reader["NoWriteFen"].ToString().Split(new char[] { '#' });
                string[] strArray3 = reader["ErrorFen"].ToString().Split(new char[] { '#' });
                this.txtAErrFen.Text = strArray3[0].ToString();
                this.txtBErrFen.Text = strArray3[1].ToString();
                this.txtCErrFen.Text = strArray3[2].ToString();
                this.txtANoWriteFen.Text = strArray2[0].ToString();
                this.txtBNoWriteFen.Text = strArray2[1].ToString();
                this.txtCNoWriteFen.Text = strArray2[2].ToString();
                this.txtStartDate.Text = reader["PaperStartTime"].ToString().Substring(0, reader["PaperStartTime"].ToString().LastIndexOf(" "));
                this.txtEndDate.Text = reader["PaperEndTime"].ToString().Substring(0, reader["PaperEndTime"].ToString().LastIndexOf(" "));
                this.DDLStartH.SelectedIndex = -1;
                this.DDLStartM.SelectedIndex = -1;
                this.DDLEndH.SelectedIndex = -1;
                this.DDLEndM.SelectedIndex = -1;
                this.DDLStartH.Items.FindByValue(Convert.ToDateTime(reader["PaperStartTime"]).Hour.ToString()).Selected = true;
                this.DDLStartM.Items.FindByValue(reader["PaperStartTime"].ToString().Substring(reader["PaperStartTime"].ToString().IndexOf(":") + 1, 2)).Selected = true;
                this.DDLEndH.Items.FindByValue(Convert.ToDateTime(reader["PaperEndTime"]).Hour.ToString()).Selected = true;
                this.DDLEndM.Items.FindByValue(reader["PaperEndTime"].ToString().Substring(reader["PaperEndTime"].ToString().IndexOf(":") + 1, 2)).Selected = true;
                this.RBLEnterTime.SelectedIndex = -1;
                this.RBLEnterTime.Items.FindByValue(reader["EnterTime"].ToString()).Selected = true;
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        private void method_2()
        {
            int num = 0;
            string cmdText = "select ParmName from SysParmInfo where ParmMemo='RubricType' order by ParmValue";
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                switch (num)
                {
                    case 0:
                        this.txtRubricATip.Text = reader["ParmName"].ToString();
                        break;

                    case 1:
                        this.txtRubricBTip.Text = reader["ParmName"].ToString();
                        break;

                    case 2:
                        this.txtRubricCTip.Text = reader["ParmName"].ToString();
                        break;

                    case 3:
                        this.txtRubricDTip.Text = reader["ParmName"].ToString();
                        break;

                    case 4:
                        this.txtRubricETip.Text = reader["ParmName"].ToString();
                        break;

                    case 5:
                        this.txtRubricFTip.Text = reader["ParmName"].ToString();
                        break;

                    case 6:
                        this.txtRubricGTip.Text = reader["ParmName"].ToString();
                        break;

                    case 7:
                        this.txtRubricHTip.Text = reader["ParmName"].ToString();
                        break;

                    case 8:
                        this.txtRubricITip.Text = reader["ParmName"].ToString();
                        break;

                    case 9:
                        this.txtRubricJTip.Text = reader["ParmName"].ToString();
                        break;
                }
                num++;
            }
            if (this.txtRubricATip.Text.Trim() == "")
            {
                this.txtRubricATip.Text = "单选题";
            }
            if (this.txtRubricBTip.Text.Trim() == "")
            {
                this.txtRubricBTip.Text = "多选题";
            }
            if (this.txtRubricCTip.Text.Trim() == "")
            {
                this.txtRubricCTip.Text = "判断题";
            }
            if (this.txtRubricDTip.Text.Trim() == "")
            {
                this.txtRubricDTip.Text = "填空题";
            }
            if (this.txtRubricETip.Text.Trim() == "")
            {
                this.txtRubricETip.Text = "简答题";
            }
            if (this.txtRubricFTip.Text.Trim() == "")
            {
                this.txtRubricFTip.Text = "作文题";
            }
            if (this.txtRubricGTip.Text.Trim() == "")
            {
                this.txtRubricGTip.Text = "论述题";
            }
            if (this.txtRubricHTip.Text.Trim() == "")
            {
                this.txtRubricHTip.Text = "分析题";
            }
            if (this.txtRubricITip.Text.Trim() == "")
            {
                this.txtRubricITip.Text = "操作题";
            }
            if (this.txtRubricJTip.Text.Trim() == "")
            {
                this.txtRubricJTip.Text = "综合题";
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        private void method_3()
        {
            SqlConnection selectConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            SqlDataAdapter adapter = new SqlDataAdapter("select a.UserCode,a.UserName from UserInfo a,UserPower b where b.CheckPaper='Y' and a.UserCode=b.UserCode ", selectConnection);
            DataSet dataSet = new DataSet();
            adapter.Fill(dataSet, "UserInfo");
            this.DDLCheckUser.DataTextField = "UserName";
            this.DDLCheckUser.DataValueField = "UserCode";
            this.DDLCheckUser.DataSource = dataSet.Tables["UserInfo"].DefaultView;
            this.DDLCheckUser.DataBind();
            adapter.Dispose();
            dataSet.Dispose();
            selectConnection.Dispose();
            this.DDLCheckUser.Items.Insert(0, new ListItem("--无需审核--", "0"));
        }

        private void method_4()
        {
            string selectCommandText = "";
            selectCommandText = "select ID,TemplateName from TemplatePaper order by ID desc";
            SqlConnection selectConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            SqlDataAdapter adapter = new SqlDataAdapter(selectCommandText, selectConnection);
            DataSet dataSet = new DataSet();
            adapter.Fill(dataSet, "TemplatePaper");
            this.DDLPaperTemplet.DataTextField = "TemplateName";
            this.DDLPaperTemplet.DataValueField = "ID";
            this.DDLPaperTemplet.DataSource = dataSet.Tables["TemplatePaper"].DefaultView;
            this.DDLPaperTemplet.DataBind();
            adapter.Dispose();
            dataSet.Dispose();
            selectConnection.Dispose();
            this.DDLPaperTemplet.Items.Insert(0, new ListItem("--自定义试卷参数--", "0"));
        }

        private void method_5()
        {
            this.strSubjectName = base.Request.Form["txtSubjectName"].ToString().Trim();
            this.strSubjectID = base.Request.Form["txtSubjectID"].ToString().Trim();
            string[] strArray = this.strSubjectID.Split(new char[] { ',' });
            string str = "";
            for (int i = 0; i < strArray.Length; i++)
            {
                if (strArray[i].Trim() != "")
                {
                    if (str.Trim().Length != 0)
                    {
                        str = str + " or SubjectID='" + strArray[i].Trim() + "' ";
                    }
                    else
                    {
                        str = " (SubjectID='" + strArray[i].Trim() + "' ";
                    }
                }
            }
            if (str.Trim() != "")
            {
                str = str + ")";
            }
            else
            {
                str = " ID<>0 ";
            }
            if (strArray.Length > 0)
            {
                if (!this.CBReadOtherUnit.Checked)
                {
                    this.labSumA.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='A' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                    this.labSumB.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='B' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                    this.labSumC.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='C' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                    this.labSumD.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='D' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                    this.labSumE.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='E' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                    this.labSumF.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='F' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                    this.labSumG.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='G' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                    this.labSumH.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='H' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                    this.labSumI.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='I' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                    this.labSumJ.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='J' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "')", "RubricCount") + "</span>道</p>";
                }
                else
                {
                    this.labSumA.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='A' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                    this.labSumB.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='B' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                    this.labSumC.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='C' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                    this.labSumD.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='D' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                    this.labSumE.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='E' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                    this.labSumF.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='F' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                    this.labSumG.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='G' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                    this.labSumH.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='H' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                    this.labSumI.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='I' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                    this.labSumJ.Text = "<p>题库共<span>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='J' and Flag='" + this.RBLExamType.SelectedItem.Value + "' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</span>道</p>";
                }
            }
            else
            {
                this.labSumA.Text = "<p>题库共<span>0</span>道</p>";
                this.labSumB.Text = "<p>题库共<span>0</span>道</p>";
                this.labSumC.Text = "<p>题库共<span>0</span>道</p>";
                this.labSumD.Text = "<p>题库共<span>0</span>道</p>";
                this.labSumE.Text = "<p>题库共<span>0</span>道</p>";
                this.labSumF.Text = "<p>题库共<span>0</span>道</p>";
                this.labSumG.Text = "<p>题库共<span>0</span>道</p>";
                this.labSumH.Text = "<p>题库共<span>0</span>道</p>";
                this.labSumI.Text = "<p>题库共<span>0</span>道</p>";
                this.labSumJ.Text = "<p>题库共<span>0</span>道</p>";
            }
        }

        private int method_6(int int_0)
        {
            string str = "";
            string str2 = "";
            string str3 = "";
            string str4 = "";
            string str5 = "";
            string str6 = "";
            string str7 = "";
            string str8 = "";
            string str9 = "";
            string strSql = "";
            string str11 = "";
            if (this.txtRubricJSum.Text.Trim() != "0")
            {
                str11 = this.txtRubricJSum.Text.Trim().Replace("_", "#") + "#";
            }
            strSql = "Insert into PaperDataTmp(PaperID,RubricS,RubricD,RubricB,RubricF,RubricA,RubricC,RubricT,RubricAN,RubricO,RubricJ) values(" + int_0;
            strSql = strSql + ",'" + str + "','" + str2 + "','" + str3 + "','" + str4 + "','" + str5 + "','" + str6 + "','" + str7 + "','" + str8 + "','" + str9 + "','" + str11 + "')";
            if (this.publicFun_0.ExecuteSql(strSql) == 0)
            {
                return 1;
            }
            return 0;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            if (!((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false))
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
            else
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                if (base.Request["ID"] != null)
                {
                    this.intID = Convert.ToInt32(base.Request["ID"].ToString());
                }
                else
                {
                    this.intID = 0;
                }
                if (base.IsPostBack)
                {
                    this.strSubjectName = base.Request.Form["txtSubjectName"].ToString().Trim();
                    this.strSubjectID = base.Request.Form["txtSubjectID"].ToString().Trim();
                    this.txtRubricJSum.Text = base.Request.Form["txtRubricJSum"].ToString().Trim();
                    this.txtRubricJFen.Text = base.Request.Form["txtRubricJFen"].ToString().Trim();
                    this.txtSumJRubricType.Text = base.Request.Form["txtSumJRubricType"].ToString().Trim();
                }
                else if (this.publicFun_0.ReturnPaperData() == "Yes")
                {
                    SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
                    connection.Open();
                    SqlCommand command = new SqlCommand("select AddPaper,ManagPaper from UserPower where UserCode='" + this.httpCookie_0.Value + "'", connection);
                    SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                    if (reader.Read())
                    {
                        this.ViewState["AddPower"] = reader["AddPaper"].ToString();
                        this.ViewState["ManagPower"] = reader["ManagPaper"].ToString();
                    }
                    reader.Close();
                    command.Dispose();
                    connection.Close();
                    connection.Dispose();
                    this.Page.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString;
                    if ((this.ViewState["AddPower"].ToString() != "Y") && (this.ViewState["ManagPower"].ToString() != "Y"))
                    {
                        this.butDefault.Enabled = false;
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BCheck", "alert('人工组卷权限未开放！')", true);
                    }
                    else
                    {
                        this.butDefault.Attributes.Add("onclick", "javascript:{if(confirm('确定试卷参数无误，要进行下一步吗？')==false) return false;}");
                        this.method_2();
                        this.txtStartDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
                        this.txtEndDate.Text = DateTime.Now.AddDays(1.0).ToString("yyyy-MM-dd");
                        this.method_0();
                        this.method_4();
                        this.method_3();
                        if (base.Request["ID"] != null)
                        {
                            this.method_1();
                        }
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BCheck", "alert('此版本暂未授权,请拔打(0)13870606104手机号进行授权！')", true);
                }
            }
        }
    }
}

